﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using Smartec.Accounts.Camel.AMS.Model.Facades;

namespace Smartec.Accounts.Camel.AMS.Model.Entities.Validation
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
    public class CustomRegularExpressionAttribute : RegularExpressionAttribute
    {
        public string ErrorEn;
        public string ErrorAr;
        public CustomRegularExpressionAttribute(string pattern, string ARMessage, string ENMessage)
            : base(pattern)
        { ErrorEn = ENMessage; ErrorAr = ARMessage; }
        public override string FormatErrorMessage(string name)
        {
            return LocalizationContext.Language.ToString().ToLower() == "en" ? ErrorEn : ErrorAr;
        }
    }
}
